<?php
class PNRecommendUserTopicsArray extends PNObjectExArray {
  function PNRecommendUserTopicsArray($init=null, $where='')
  {
    $this->PNObject();

    $this->_objType       = 'innoforum_topics';
    $this->_objField      = 'id';
    $this->_objPath       = 'form';
    $this->_init($init, $where);
  
  }
/*
  function genSort(){
  }
*/

  function genFilter(){
    $sql = "select count(*) as 'topic',tpc_cr_uid from zk_innoforum_topics where tpc_cr_uid != 2 group by tpc_cr_uid order by topic DESC Limit 0,5 ";
    $column = array("topic","uid");
    $result = DBUtil::executeSQL($sql);
    $objectArray = DBUtil::marshallObjects ($result, $column);
    $value = $objectArray['0']['count'];

    $where = "tpc_cr_uid != 2";
    return $where;
  }

  function selectExtendResult(){
    $user_id = DataUtil::formatForStore(FormUtil::getPassedValue ('user_id', false));
    $result = array();
    if ($user_id){
      $result['user'] = InnoUtil::getUserInfo($user_id);
    }

      $result['firstimages'] = DBUtil::selectObject('innoforum_topics' , "WHERE tpc_id = '$id'" ,array('id','firstimage','firsthumbimage'));

    return $result;
  }
}